Skip to content

refactor: replace deprecated use of vim.diagnostic.is_disabled() #2781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 25, 2024
Merged

refactor: replace deprecated use of vim.diagnostic.is_disabled() #2781

merged 5 commits into from
May 25, 2024

Conversation

ZacharyRizer
Copy link
Contributor

@ZacharyRizer ZacharyRizer commented May 24, 2024

According to Neovims Release news in the newly released v.0.10 vim.diagnostic.is_disabled() is deprecated in favor of vim.diagnostic.is_enabled().

I wasn't sure if there should be backwards compatibility left in for v0.9 or not. I'm not very solid with Lua, so I don't know if that if/else makes sense to 'solve' backwards compatibility.

@ZacharyRizer ZacharyRizer marked this pull request as draft May 24, 2024 00:35
@ZacharyRizer ZacharyRizer changed the title Deprecation fix fix:deprecated use of vim.diagnostic.is_disabled() May 24, 2024
@ZacharyRizer ZacharyRizer marked this pull request as ready for review May 24, 2024 00:59
@ZacharyRizer ZacharyRizer changed the title fix:deprecated use of vim.diagnostic.is_disabled() fix: deprecated use of vim.diagnostic.is_disabled() May 24, 2024
@alex-courtis
Copy link
Member

I wasn't sure if there should be backwards compatibility left in for v0.9 or not. I'm not very solid with Lua, so I don't know if that if/else makes sense to 'solve' backwards compatibility.

Thank you, we do need to retain compatibility.

Those tests work - has 0.10 will still be true for 0.11...

@alex-courtis alex-courtis changed the title fix: deprecated use of vim.diagnostic.is_disabled() refactor: deprecated use of vim.diagnostic.is_disabled() May 25, 2024
@alex-courtis alex-courtis changed the title refactor: deprecated use of vim.diagnostic.is_disabled() refactor: replace deprecated use of vim.diagnostic.is_disabled() May 25, 2024
Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for your contribution!

Now that 0.10 is released we can start on #2731 - any assistance on that would be most gratefully appreciated. That will allow us to pick up on these sorts of issues.

@alex-courtis alex-courtis merged commit 4215f33 into nvim-tree:master May 25, 2024
7 checks passed
@AntonC9018
Copy link

This gives me an error that is_enabled is not defined.

Error executing vim.schedule lua callback: ...re/nvim/lazy/nvim-tree.lua/lua/nvim-tree/diagnostics.lua:44: attempt to call field 'is_enabled' (a nil value)
stack traceback:
	...re/nvim/lazy/nvim-tree.lua/lua/nvim-tree/diagnostics.lua:44: in function 'from_nvim_lsp'
	...re/nvim/lazy/nvim-tree.lua/lua/nvim-tree/diagnostics.lua:158: in function 'callback'
	...al/share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/utils.lua:422: in function <...al/share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/utils.lua:421>
❯ nvim --version
NVIM v0.10.0-dev-2499+g0d553c834
Build type: RelWithDebInfo
LuaJIT 2.1.1707061634

@alex-courtis
Copy link
Member

Let's revert this one. It looks like it's not present in older 0.10 builds, which people do actively use.

alex-courtis added a commit that referenced this pull request May 26, 2024
alex-courtis added a commit that referenced this pull request May 26, 2024
…_disabled()" (#2784)

Revert "refactor: replace deprecated use of vim.diagnostic.is_disabled()  (#2781)"

This reverts commit 4215f33.
@alex-courtis
Copy link
Member

Reverted in #2784

@gegoune
Copy link
Collaborator

gegoune commented May 26, 2024

We need some other implementation of that check then as it affects users on new enough versions.

@alex-courtis
Copy link
Member

alex-courtis commented May 26, 2024

We need some other implementation of that check then as it affects users on new enough versions.

Yes. Now that stable is 0.10 we should add 0.9 back to the matrix.

The 0.10 dev versions are a problem; API broke many times.

Edit: we might be able to test for pre-release: :h api-metadata

@alex-courtis
Copy link
Member

alex-courtis commented May 28, 2024

Fortunately, API levels have been implemented and are available since 0.9

#2787

We'll need to increase the minimum supported version to 0.9.

Unfortunately we're not going to get any value out of CI as 0.9 lacks the API symbols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants